package org.hanson;

import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;

public class RedisWriter {

    private Logger logger = LoggerFactory.getLogger(RedisSource.class);

    private Jedis jedis;

    public static String AREA_CODE_KEY = "Area";

    public RedisWriter() {
        this.jedis = new Jedis("bigdata02",6379);
    }

    public void update(String areaCode) {
        Map<String, String> hash = new HashMap<String, String>();
        hash = this.jedis.hgetAll(AREA_CODE_KEY);

        hash.put(AREA_CODE_KEY, areaCode);

        this.jedis.hset(AREA_CODE_KEY, hash);
    }
}
